home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / Bomber Bob.swf / scripts / DefineSprite_62 / frame_1 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  1.9 KB  |  112 lines

  1. stop();
  2. speed = 0;
  3. cont = 0;
  4. this.onEnterFrame = function()
  5. {
  6.    cont2++;
  7.    if(cont2 % 3 == 0)
  8.    {
  9.       if(Key.isDown(32))
  10.       {
  11.          if(_root.sunet == 1)
  12.          {
  13.             _root.son1.start();
  14.          }
  15.          _root.gl.duplicateMovieClip("gl" + cont,cont);
  16.          _root["gl" + cont].gotoAndPlay(1);
  17.          _root["gl" + cont]._rotation = _root.plane._rotation;
  18.          _root["gl" + cont]._x = _root.plane._x + 10;
  19.          _root["gl" + cont]._y = _root.plane._y;
  20.          cont++;
  21.       }
  22.    }
  23.    if(cont > 100)
  24.    {
  25.       cont = 0;
  26.    }
  27.    if(_Y + speed > 20)
  28.    {
  29.       _Y = _Y + speed;
  30.    }
  31.    else
  32.    {
  33.       speed = Math.abs(speed);
  34.    }
  35.    if(_Y + speed < 340)
  36.    {
  37.       _Y = _Y + speed;
  38.    }
  39.    else
  40.    {
  41.       speed = - Math.abs(speed);
  42.    }
  43.    if(_X + speeX > 80)
  44.    {
  45.       _X = _X + speedX;
  46.    }
  47.    else
  48.    {
  49.       speedX = Math.abs(speedX);
  50.    }
  51.    if(_X + speed < 530)
  52.    {
  53.       _X = _X + speedX;
  54.    }
  55.    else
  56.    {
  57.       speedX = - Math.abs(speedX);
  58.    }
  59.    _X = _X + speedX;
  60.    if(Key.isDown(38))
  61.    {
  62.       speed = -3;
  63.       if(_rotation > -60)
  64.       {
  65.          _rotation = _rotation - 4;
  66.       }
  67.    }
  68.    else if(Key.isDown(40))
  69.    {
  70.       speed = 3;
  71.       if(_rotation < 60)
  72.       {
  73.          _rotation = _rotation + 4;
  74.       }
  75.    }
  76.    else if(speed > 0)
  77.    {
  78.       speed -= 0.5;
  79.    }
  80.    else if(speed < 0)
  81.    {
  82.       speed += 0.5;
  83.    }
  84.    if(Key.isDown(37))
  85.    {
  86.       speedX = -3;
  87.    }
  88.    else if(Key.isDown(39))
  89.    {
  90.       speedX = 3;
  91.    }
  92.    else if(speedX > 0)
  93.    {
  94.       speedX -= 0.25;
  95.    }
  96.    else if(speedX < 0)
  97.    {
  98.       speedX += 0.25;
  99.    }
  100.    if(!Key.isDown(38) && !Key.isDown(40))
  101.    {
  102.       if(_rotation > 0)
  103.       {
  104.          _rotation = _rotation - 4;
  105.       }
  106.       else if(_rotation < 0)
  107.       {
  108.          _rotation = _rotation + 4;
  109.       }
  110.    }
  111. };
  112.